<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>文件下载</title>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #f5f7fa;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            color: #333;
        }
        .container {
            background-color: white;
            border-radius: 10px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
            padding: 30px;
            width: 90%;
            max-width: 500px;
            text-align: center;
        }
        h1 {
            color: #4a6ee0;
            margin-bottom: 20px;
        }
        p {
            color: #666;
            margin-bottom: 25px;
            line-height: 1.6;
        }
        .file-icon {
            font-size: 64px;
            color: #4a6ee0;
            margin-bottom: 20px;
        }
        .file-info {
            background-color: #f9f9f9;
            border-radius: 8px;
            padding: 20px;
            margin-bottom: 25px;
        }
        .file-name {
            font-weight: 500;
            font-size: 18px;
            margin-bottom: 10px;
            word-break: break-all;
        }
        .file-meta {
            display: flex;
            justify-content: center;
            gap: 20px;
            color: #666;
            font-size: 14px;
        }
        .meta-item {
            display: flex;
            align-items: center;
        }
        .meta-icon {
            margin-right: 5px;
        }
        .btn {
            background-color: #4a6ee0;
            color: white;
            border: none;
            padding: 12px 25px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 16px;
            transition: background-color 0.3s;
            text-decoration: none;
            display: inline-block;
        }
        .btn:hover {
            background-color: #3a5ecc;
        }
        .btn-large {
            padding: 15px 30px;
            font-size: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto;
            max-width: 250px;
        }
        .btn-icon {
            margin-right: 10px;
            font-size: 20px;
        }
        .expiry-info {
            margin-top: 20px;
            font-size: 14px;
            color: #ff6b6b;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .expiry-icon {
            margin-right: 5px;
        }
        .security-note {
            margin-top: 30px;
            background-color: #f0f5ff;
            border-radius: 8px;
            padding: 15px;
            font-size: 14px;
            color: #666;
            text-align: left;
        }
        .security-title {
            display: flex;
            align-items: center;
            color: #4a6ee0;
            margin-bottom: 10px;
            font-weight: 500;
        }
        .security-icon {
            margin-right: 5px;
        }
        footer {
            margin-top: 30px;
            font-size: 12px;
            color: #999;
        }
    </style>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
</head>
<body>
    <div class="container">
        <div class="file-icon">
            <i class="fas fa-file-alt"></i>
        </div>
        <h1>文件下载</h1>
        
        <div class="file-info">
            <div class="file-name">{{ filename }}</div>
            <div class="file-meta">
                <div class="meta-item">
                    <span class="meta-icon"><i class="fas fa-clock"></i></span>
                    <span id="expiry-time">24小时后过期</span>
                </div>
                <div class="meta-item">
                    <span class="meta-icon"><i class="fas fa-download"></i></span>
                    <span>{{ download_count }}次下载</span>
                </div>
            </div>
        </div>
        
        <a href="{{ download_url }}" class="btn btn-large">
            <span class="btn-icon"><i class="fas fa-download"></i></span>
            下载文件
        </a>
        
        <div class="expiry-info">
            <span class="expiry-icon"><i class="fas fa-exclamation-circle"></i></span>
            此链接将在24小时后自动失效
        </div>
        
        <div class="security-note">
            <div class="security-title">
                <span class="security-icon"><i class="fas fa-shield-alt"></i></span>
                安全提示
            </div>
            <ul style="margin: 0; padding-left: 20px;">
                <li>此文件由其他用户上传并分享</li>
                <li>下载前请确认文件来源可信</li>
                <li>文件将在24小时后自动删除</li>
            </ul>
        </div>
        
        <footer>
            &copy; 2025 临时文件分享服务
        </footer>
    </div>

    <script>
        // 计算并显示剩余过期时间
        function updateExpiryTime() {
            const expiryTimestamp = {{ expiry_time }} * 1000; // 转换为毫秒
            const now = new Date().getTime();
            const timeLeft = expiryTimestamp - now;
            
            if (timeLeft <= 0) {
                document.getElementById('expiry-time').textContent = '已过期';
                return;
            }
            
            const hours = Math.floor(timeLeft / (1000 * 60 * 60));
            const minutes = Math.floor((timeLeft % (1000 * 60 * 60)) / (1000 * 60));
            
            document.getElementById('expiry-time').textContent = 
                `${hours}小时${minutes}分钟后过期`;
        }
        
        // 页面加载时更新过期时间
        updateExpiryTime();
        
        // 每分钟更新一次过期时间
        setInterval(updateExpiryTime, 60000);
    </script>
</body>
</html>